#ifndef __APPLICATION_H
#define __APPLICATION_H

#include "bsp.h"

#define ALIYUN_ITEM_NAME_LEN (32 + 1)
#define DOMAIN_LEN	(64)

#define  P_TOPIC_PATH_NUM			128

typedef struct
{
	char productKey[ALIYUN_ITEM_NAME_LEN];
	char deviceName[ALIYUN_ITEM_NAME_LEN];
	char deviceSecre[ALIYUN_ITEM_NAME_LEN];
	char ipOrDomain[DOMAIN_LEN];
	u16 port;
	char p_topic[P_TOPIC_PATH_NUM];
	char s_topic[P_TOPIC_PATH_NUM];
}AliyunLinkInfo;

typedef enum
{
	COMM
}SYS_STATE_ENUM;

typedef enum
{
	LED2_TOGG_COMM = 0,
	LED2_TOGG_FAST,
	LED2_TOGG_SLOW
}SYS_LED2_TOGG_STATE_ENUM;

#define FIRST_UPLOAD_FLAG (0X7F)
typedef struct
{
	u8 first_upload_f;
	u32 hold_time;
}APP_INFO;

typedef struct 
{
	u8 fingerprint_match_f;	
	u8 led1_toggle_f;				
	u8 led2_toggle_f;
}RUNNING_FLAG_STRU;

typedef struct
{
	u8 register_fingerprint_f;
	u8 remover_fingerprint_f;
	u8 identify_fingerprint_f;
	u8 open_high_pwr_f;	//大功率输出已打开标志位 
	u32 close_high_pwr_count;
	u8 set_hold_time_f;
}APP_FLAG;

typedef struct
{
	AliyunLinkInfo aliyunInfo;
	SYS_STATE_ENUM state;
	u8 fingerprint_touch_f;
	RUNNING_FLAG_STRU run_flags;
	u64 runing_couter;	
	u32 hold_time;	//保持时间
	APP_INFO info;
}SYSTEM_STRU;

void APP_Init(void);
void APP_MQTT_Process(void);
void APP_FingerPrintOperate_Process(void);
void APP_FingerPrintMattch_Process(void);
void APP_InputChenalAction_Process(void);
void APP_GPS_Process(void);
void APP_ProcessPOOL(void);
void APP_SysInit(void);
u8 APP_IsFirstUpload(void);


extern SYSTEM_STRU sys;
extern APP_FLAG app_flags;


#endif

